package com.hjl.hos_hjl_test3.slice;

import com.hjl.hos_hjl_test3.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Component;
import ohos.agp.components.DirectionalLayout;
import ohos.agp.components.Image;

public class MainAbilitySlice extends AbilitySlice {
    DirectionalLayout layout;
    Image white1;
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_main);
      layout = (DirectionalLayout) this.findComponentById(ResourceTable.Id_laylout1);
        white1 = (Image) this.findComponentById(ResourceTable.Id_white);
       layout.setDoubleClickedListener(new Component.DoubleClickedListener() {
           @Override
           public void onDoubleClick(Component component) {
               white1.setImageAndDecodeBounds(ResourceTable.Media_red);
           }
       });
       white1.setDoubleClickedListener(new Component.DoubleClickedListener() {
           @Override
           public void onDoubleClick(Component component) {
               white1.setImageAndDecodeBounds(ResourceTable.Media_white);
           }
       });
    }

    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }
}
